﻿/*!	@file	r_author_server.h
	@brief	オーサリング
Copyright (c) 2010 Yuya Yamaguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#ifndef _R_AUTOHR_SERVER_H_
#define _R_AUTOHR_SERVER_H_

#include "../rtti/r_rtti_class_base.h"
#include "../util/r_util_singleton.h"
#include "../alloc/r_alloc_allocator.h"

#include <vector>

class cRAuthorNode;
typedef	std::vector<cRAuthorNode*, tRAllocDeclared<cRAuthorNode*, eRAllocDef_Game>>	cRAuthorNode_array;

//! オーサリングサーバ
/*!
*/
class cRAuthorServer : public r::rtti::ClassBase
{
	RRTTI_REFLECTION_DECLARE
	RSINGLETONTGET_DECLARE ( cRAuthorServer )
public:
	//! コンストラクタ
	/*!
	*/
	cRAuthorServer();
	//! デストラクタ
	/*!
	*/
	virtual	~cRAuthorServer();
public:
	// システムコール
	//! 更新
	/*!
	*/
	void					update();
public:
	//! 更新の有効/無効設定
	/*!
	*/
	void					setUpdatable ( r_bool enable );
	//! 更新の有効/無効取得
	/*!
	*/
	r_bool					getUpdatable() const;
	//! 時間の設定
	/*!
	*/
	void					setTime ( r_f32 _time );
	//! 時間の取得
	/*!
	*/
	r_f32					getTime() const;
	//! ノードの追加
	/*!
	*/
	void					addNode ( cRAuthorNode* _node );
	//! ノードの数
	/*!
	*/
	r_size					getNodeNum() const;
	//! ノードの参照
	/*!
	*/
	const	cRAuthorNode*	getNode ( r_size index ) const;
	//! ノードの削除
	/*!
	*/
	void					removeNode ( r_size index );
protected:
private:
	//! 更新有効/無効
	r_bool					isUpdatable;
	//! マスター時間
	r_f32					time;
	//! ノード
	cRAuthorNode_array		node;
};

#endif // _R_AUTOHR_SERVER_H_

